#==============================
Title: The Impact of Educational Content on Anti-Immigrant Attitudes 
Author: Boyoon Lee
Email: boyoon.lee.lby@gmail.com
This version: November 19, 2022
#==============================

Technical Disclaimer:

Initial analyses in R version 3.5.1 and RStudio version 1.1.463.
All analyses re-done in R version 4.0.3 and RStudio version 1.3.1093 ("Apricot Nasturtium" (aee44535, 2020-09-17) for Windows) during the revision process.
Used Windows 10 Enterprise, 64-bit.


##############################
# 	     Codes           #
##############################
The replication archive contains the following R scripts:

1_1_Main_Figure1_textbook.R -- This script reads in data from textbook_word_freq.Rda and creates Figure 1. While it also includes the code to create the textbook_word_freq.Rda file from the original content of the textbooks, the underlying textbook content is not provided in this replication archive due to the potential copyright issues associated with the textbooks. 

1_2_Main_analysis_results -- This script reads in data from cleaned_TSCS_did.csv and matched_data_Ver3_5_1.Rda to produce main results in the paper (Table 2, Table 3, Table 4, and Figure 2).  

2_Online_Appendix_B -- This script reads in data from cleaned_TSCS_did.csv and creates Online Appendix Figure B.4. 

3_Online_Appendix_C -- This script reads in data from cleaned_TSCS_did.csv and matched_data_Ver3_5_1.Rda to produce Online Appendix Table C.2, Table C.3, and Table C.4. 

4_Online_Appendix_D -- This script reads in cleaned_TSCS_did.csv, matched_data_Ver3_5_1.Rda, and matched_data_pre_Ver3_5_1.Rda to create Online Appendix Figure D.5, Table D.5, and Table D.6. It also include processes for creating the two matched data sets (matched_data_Ver3_5_1.Rda and matched_data_pre_Ver3_5_1.Rda). Note that the matched data sets are constructed under R version 3.5.1. While the code to create the data sets is present, you must have the corresponding version of R in order to replicate the creation of the data set. Users with R versions higher than 3.6.0 will see different results due to the sample() algorithm changes for the set.seed() function used to create the matched data sets. 

5_Online_Appendix_E -- This script reads in cleaned_TSCS_did.csv and matched_data_Ver_3_5_1.Rda and creates Online Appendix Figure E.6, Figure E.7, and Table E.7.

6_Online_Appendix_F -- This script reads in cleaned_TSCS_did.csv and creates Table F.8, Table F.9, Table F.10, and Table F.11.



##############################
# 	  Data sets          #
##############################
The replication archive contains the following data sets:

textbook_word_freq.Rda -- Data on word frequencies in the old and new (Renshi Taiwan) textbooks. 

cleaned_TSCS_did.csv -- Main data set for replication. Note that terms of use do not allow for the Taiwan Social Change Survey data to be directly shared in a replication archive in its original form. Potential users must agree on their terms and conditions to download data sets at their website (https://www2.ios.sinica.edu.tw/sc/en/scDownload3.php). Thus, this data set is the cleaned version of the original data sets downloaded from Taiwan Social Change Survey, including only relevant variables to reproduce the results in the paper.  

matched_data_Ver3_5_1.Rda -- Data extracted from matching results using all imbalanced covariates. See Online_Appenedix_D.R for the detailed code to produce the data set. 

matched_data_pre_Ver3_5_1.Rda -- Data extracted from matching results using pre-treatment covariates. See Online_Appendix_D.R for the detailed code to produce the data set. 



##############################
# 	 Other files         #
##############################

Readme.text -- Readme file with table of contents of all files
Codebook.pdf -- Codebook with variable definitions